﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MapViewer.Model
{
	[MapViewer.Loaders.LoaderType(LoaderType = typeof(MapViewer.Loaders.FolderLoader))]
	class FolderRecentItem : RecentItem
	{
		[System.Runtime.InteropServices.DllImport("shlwapi.dll")]
		static extern bool PathCompactPathEx([System.Runtime.InteropServices.Out] StringBuilder pszOut, string szPath, int cchMax, int dwFlags);

		public String FolderPath { get; set; }

		public override string Title
		{
			get
			{
				StringBuilder builder = new StringBuilder(100);
				PathCompactPathEx(builder, FolderPath, 100, 0);
				return builder.ToString();
			}
		}

		internal override void ParseValue(string definition)
		{
			FolderPath = definition;
		}

		public override string Definition
		{
			get
			{
				return base.Definition + FolderPath;
			}
		}
	}
}
